package system.controller;

import common.controller.base.BaseController;
import common.model.response.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import system.config.aliyun.oss.OssService;
import system.model.response.GenerateCredentialsResponse;

import javax.annotation.Resource;

/**
 * 阿里云OSS管理
 *
 * @author 米泽鹏
 * @since 2023-11-06
 */
@Api(tags = "阿里云OSS管理")
@RestController
@RequestMapping("/system/oss")
public class OssController extends BaseController {

	@Resource
	private OssService ossService;

	/**
	 * 生成OSS临时凭证角色（上传）
	 */
	@ApiOperation(value = "生成OSS临时凭证角色（上传）", notes = "生成OSS临时凭证角色（上传）", response = Result.class)
	@PostMapping("/generateCredentials")
	public Result<GenerateCredentialsResponse> generateCredentials() {
		return successWithData(ossService.generateCredentialsForUpload());
	}

}
